package com.music.service.Impl;

import com.music.mapper.FavListMapper;
import com.music.service.FavListService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@Service
@Transactional // 启用事务管理
public class FavListServiceImpl implements FavListService {

    private final FavListMapper favListMapper;

    public FavListServiceImpl(FavListMapper favListMapper) {
        this.favListMapper = favListMapper;
    }

    @Override
    public int addFavouriteList(Map<String, Object> favouriteList) {
        return favListMapper.addFavouriteList(favouriteList);
    }

    @Override
    public List<Map<String, Object>> showAllFavouriteLists() {
        return favListMapper.showAllFavouriteLists();
    }

    @Override
    public int deleteFavouriteList(int ListID) {
        return favListMapper.deleteFavouriteList(ListID);
    }

    @Override
    public int addSongToFavouriteList(Map<String, Object> songInfo) {
        return favListMapper.addSongToFavouriteList(songInfo);
    }

    @Override
    public int updateFavouriteList(Map<String, Object> favouriteList) {
        return favListMapper.updateFavouriteList(favouriteList);
    }

    @Override
    public List<Map<String, Object>> showSongsByListId(int ListID) {
        return favListMapper.showSongsByListId(ListID);
    }
}
